Reference check should come first