Added one more condition to validation function and fixed validator call