model improvements and bug fixes