Fix permissions and properly clean up after half-dead NM