Handle undefined left and right nodes for small trees

Fixes #15