Fixing problem on halt