fixed lastTime to query