Fixed piping and file permissions for redirect
Fixed piping and file permissions for redirect