Portability + logic on detection of HEAD