fixes some rare minor bugs