added encoding to support older python version