Replace empty? by blank? as nil doesn't respond for empty?