Fixed issues with midpoint rooting

Limited testing, but should work.