Python 3 compatibility fix