Minor fixes due to compatibility with Python 3