added workaround for 'wrong animation frames' bug (with debug output)