fixed a bug in script. Bash sucks.