correcting typos, misdirections, and various bugs