preventing 'apply' method call on undefined obj