fixed template source child processing order and selector bugs