Implement patch to fix animation array corruption

Similar to #417