cleanup errors, made []byte encode properly