Fix handling error blocks correctly

also Able to output the range of error blocks.