changed .nil? to .empty? in controller