Fix: undefined method `gsub!` for nil:NilClass