Fixed update query bug