fix bug in validation