modify javascript function