Tweak hacky template loader to produce more reliable results