bug fix

TODO: line 685 & 691 seems still wrong for type mismatch in makeChild