Refactor syntax unicode analysis cleanups1

Fixes a crashing bug due to memory corruption and an infinite loop on startup.