Fixes bugs in animation