entry state and query bugfixes