fixed a silly bug where local variable was accessed on object scope