Memoize the compiled template and clear the source
More fixes