fixed reference issue and other minor fixes
fixed reference issue and other minor fixes