replace system login control, and fix some bugs