added checks for failed commands