Fix bug with py2 compatibility