fix #33 thanks to @mathematicalcoffee: one sub-element bug