fix misuse of variable reference