console loging undefined variable fix