Change tests to not assume ordered dicts.
Add alternate codepath for Python 3 decodes.
Fix templating evaluation.