Fix minor bugs and minor changes