JavaScript object methods as callbacks bug fix.