Fixed use of undefined variable in validate().