OK, being more robust is probably a good idea
Made this more robust