Fix redefinition of constant.
Fix some typos and possible bugs.