Fix call undefined method `gsub` from NilClass