Added nullptr check for callbacks