fix some slow problems