Fixing error in chaining gsub