better error logging
fixed childrenByType call