Fix to get the old value with query