fixed cpp wrappers of ML tree-based models

Fix for 3.0 instead of closed #1337.