added some additional checks