fixed server connection bug and refactored Connector