fixed tests so they can be used on empty database