Fix minor bugs