A few minor error handling improvements for unusual situations.