fixed 2 error cases