Fixed a bug in parsing some named references