Fixes invalid variable reference