Fix handling error blocks correctly