Bash vars bugfix and style improvements