Fixed some minor bugs in the code.