fixed model bugs