Fix error when the callback is undefined