Fixed a crashing bug with thread children