Updated fix for BD-62: Queries sometimes fail if the schema contains overlapping alias names.