add utils::OnCleanupCallback
fix potential nullptr access in utils::AnimationManager