adding validation on generation