Fixed some minor bugs