Fixes issues with encoder changing data in-place