Fixed a bug in reference parsing