Fixed a few minor bugs