Fixes for scope of 'this' variable