Fix character corruption problem