Fix error flag check.