fix several nullpointer errors and allow debugging
fix a few logging messages