py3 compatibility fix