Fix issues discovered by shellcheck