add assertions, handle escape character