fixed a bug in the animation class