Fixed missing else block

Else block was missing in head and tail maps, 
causing disruptive behavior when root is not leaf.
Fixed.