Added check references and a more verbose error