fix bug in memwrite test