js fix

added more validation