Corrected a few small bugs