Fix a bug where callbacks would be called even if nil