Fixes issues around keyframe functions being called at the wrong time.