Fixed small error in validation function.