Python 3 compatibility

Hi!

Just a few minor changes to fix python 3 compatibility.

The fifth beta is great--I couldn't figure out how to get boost python and python 3 to play nicely in the previous beta whereas it seems to work perfectly (bar the minor changes in the attached patches) out of the box now.

Also: would you prefer to receive patches via github or via email or...?

Thanks!