fix model#dirty bugs and add specs