fixing undefined variable data