fix validation functionality