Fix wrong dict name and python 3 compatibility