fixes for bugs identified and logging for other bugs