handle exception on empty database