Fix some minor bugs