fix some model bugs