Distributrains: Regression bugfix

Fixed a serious bug introduced in the last update where dismantling a train could cause a crash