Some fixes for robustness.