Fixed a bug in Bagging code that causes Access Violation exception due to unintended stack-allocated variable destruction