fix js bug on validation