change deprecated call to file() to open()