Modify so it works even if run in stop-on-error mode (bash -e)