fix the logging bug - wrong ordering could cause nullpointer exception