Some more error handling fixes.