error checking db interactions in server, minor style fixes