Solved Issue #338

Turned out that part of the recursive traversal was missing.

Also added more test cases.