added check for HEAD to fix HEAD builds on debian