Fix javascript function wrong visibility