Bash script fixes