sfile doesn't work right inside a function