Fix for invalid variable reference