Use tilde path if possible
Fix missing engines
Fix add_external_scripts to set the right engine
Fix add_external_scripts to use the correct engine