Improved normalization in runtests.py.

Closes #161.