fix bug with class scope variables