fixing errors with emtpy database