fix some geometric bugs