minor bugfix
fixing typo & undefined variables