fixed bug related to referencing internal variables