Fix bug in validation