Fixed issue with quoted underscores in primary key attribute names.

Hopefully this should fixed the issues related to underscores in primary key attributes. All tests pasted but I don't have an example to test this against.