relative paths in template index
fixed environment detection