fix validate functionality