Corrected some minor bugs