make sure empty database doesnt cause a crash