Improved the handling of animations finish events