fix compile warnings

and add some more debug output