Added null check for callbacks