Improved attribute escaping