Python 3 compatibility fixes -- don't use map() when a list is needed.