restore termination bug, fix for #127