Template fixes for python3