working on error checking in the backend