Fix for change in list handling behavior in Python 3