Stability

Fix potential buffer overr-run in logging system.