query timeout fixes