fix validate function's prototype