Corrected a few coding sins