Nullify msg after cleanup
implement write opcode