Fix up some code related to sys_halt