make sure the callback is defined before calling it