Correction for some minor bugs