code cleanup and warning fix (clang)