Added a validity check for the handler callback.