fixed some relatively minor bugs