fix up bash logic