addressed g++ warnings and valgrind complaints
merge master