Fix compiler errors and uninitialized vars
Fix spelling error reported in #660