fixed bug with accessing member variables