Fixes minor issues with regexp and escaping