finish handling error cases