some on-the-go bugfixes and logging to trace the memory-allocation bug