Fixing some robustness issues