Some minor fixes in bash functions