fixed error where variables werent referring to instance variables