Fixes to work on Python 3 and Pyramid 1.5

I have made some minor updates to solve the obvious issues running on current versions.