fixed bad file desriptor error not properly restarted