fixing variable reference