fixed bugs with instance variables