Fixing of the link error bug and numerous little things from
the coverity pass.