fix some naive bugs