Some more error checking