fix wrong position calculation on resize