fixed several issue with escaping special characters