converted all open() to io.open() to make it more python 3 compatible