improve code and fix more template displaying
[templates] use # and empty string instead of Y and N