Fix some cases after switching to re.sub