added check for callback function existence