Fixed a bug with clearing the database