es.py fixes to preserve Python2 compatibility