Fixed creating segments in levels above leaves.
Merge branch 'master' into set_bitmaps