Fixing some system call errors brought about during the pep8 modifications, increased logging to facilitate future debugging.