added some validation