js validate bug fix