Fixed some bash bugs