Fixed the changing base dir for template retrieval.