corrected the errors in validations of the javascript