Update validator.js

minor bug fix