Some minor error handling tweaks