fixed various crashes