Fix javascript function match