Adding tests for leave, fixing issues uncovered in building tests