clean up code for sendfile