1. modified TTM.java to properly handle escaped characters.
2. tested that the code can work without memmove
   and fixed a resulting error.