Robustifying the code