fixed some schema issues, and error checking
fixed some schema issues, and error checking