Various fixes in shell scripts