Fix bug in bash code