fix height detection and other tweak