Debug: Fix Python 3 compatibility. Closes GH-565.