Partially working changes to os_writeFile