bug fixes for shell scripts