Fixed animation errors (invalid layer index).