fix child thread handling