fixed the halfing rectangle problem