correctly handle some error conditions