js logic fix.