fix fetching flag on error