Fixed bug with program crashing on empty database