put in error catch for database error