simple error checking for core data