More fixes for undefined variable checks