Error flag reading fixed