fixed error when starting from empty database