Make reading and checking a bit more robust