changed validation js logic