fix model bugs