Fix hostname and automatic sid detection