fixed shell script and filtering