Fixed recursive/remote reference resolutions. About 90% of tests pass
now.