fixed callback handling
and inserted lots of logging