small fixes for the big js logic