added some minor bugs