Fixed uncaught exception in database.