Several fixes in tui-newscript and prepare for new script templates