fixed error with variable mix up