More tests and a logic fix

- Duplicate leaves are not allowed