Fixing few code for supporting Python2.x

Close #1