Fix for query cursor timeout