Fix metadata entity flags not being read properly