normalize c++ and js versions