fixed the code to elminate warnings by clang (one was clearly a bug).