fixes to Gambit's crash problems