Fix of "multiple server" issue and some code cleanup.