fixed error with usage of wrong variable