Fixed bug where main page crashes when database is empty.