[caveman] tweaks to replaceVars etc