fix var resolution bug pointed out by Brandon Bloom

Need to check the current namespace before checking that a var is a
core var.