changed grant thread handling