Fix bug where state were queried instead of events