correctly test for return codes