Null check before applying callbacks

Added check to ensure that the item in the callbacks array is not
null/undefined before calling apply.