Fixed JS validation