Made some changes to make it compatible with python 2.6.6 and RHEL/CentOS 6.x