code cleanup from errors and warnings found with g++/gcc