More explicit error checking