Several functional fixes to logging