Bugfixes in JS and improved isDirty functionality.