fixes a crash and unchecked string-handling in ENCA code.