added reconnect option and corrected buildfile bug