fix exit crash
fix double ifdef guard