Fixed bug caused by an incorrect null check on callback parameter