fix open() calls for python3