A few code semantics issues fixed.