Add a scp_tpl built-in function and some bugfixes.