added function to validate option