fix typos, gain instability problems
partial commit