fix error handling during halt