Make the code more robust