Fix recording and listening errors in Python 2.