made some changes to make decision tree more robust. This fixes #1