Fixing unit tests and adding new one for DN check behavior.
Fix a variable name bug and fix more test issues.