compatible with python 3.3

small changes to make it work on python 3.3 as well