bugfix animate function