Fix bug with level condition handling

The level data is no longer stored at the top level of the query, so
adjust the logic to match