Fix avl implementation and build

This PR is the first of a row of PRs which will ultimately introduce internal rotation functions.
This PR fixes a couple of issues.
This also teaches me one thing: have a closer look at the PRs I ack.