removed set -o pipefail due to exit code 141 (SIGPIPE)