Patch error with encoding