Update the unsafe regex to encode parentheses and apostrophes
Fix deprecation warnings