Bug fix in validation