level calculation fixes on terrain