Add machine.halt() if write error
swapIn improved