Some improvements in bash scripts