fixed various small bugs