added a check not to try to truncate the templates path if that is the entire path