fix custom publication handler; remove print statements; improve logging