Made checks more robust