adding file detection insulation
Adding parameter validation for sendfile