Partially fixed bash scripts to work with sh