avoiding errors with empty database