Added compatibility with pyhton 2.7