fixed deadlock in memwrite example