Fix sign and compare in geometory