After glen's code revision, fixed all errors that where invoked by that.