Fixed issues in 49f74c7 for #102

Now each query knows when was it last evaluated, so it doesn't get
called multiple times in a single turn.