handling javascript code tweak