Sync with pgi changes; Properly handle escaped attributes