fixing various small bugs