Fix error that happens on empty database