code cleanup
fix model copy bug
add failing test for model isDirty