change script to run in bash for portability, fix some zsh to bash incompatibilities