Added EOS check