Fixed build process to work with Python 2.7

(thanks to Christopher Toth for the patch)