fix setMidpoint

Thanx to tom