fixed various minor bugs