added stuck detection
merged
few changes