testing success of command first