remove duplicated code and warn when master IP changes