some fixes for Python 3.x (refs #1)