fix traceback when creating department with no user selected
fix department showed up in manage and index page
merge code