some cleaning up to make things work on python 2.6.