Python 3 changes
Python 2 fix; move template load after checking if template can be loaded