Fixed some minor bugs in the code.
Fixed some minor bugs