mem leak fix + segfault fix + flush msgField onEnter