fixed bug when handling Sub nodes