Fix ordering of references