made checks more robust