SingularizeChildren functionality fix

The option singularizeChildren didn't worked as expected.
I added the function and wrote the necessary tests.