Fix 2 reference-to-undefined-variable bugs