Avoiding code that would cause problems for headpin
Merge pull request #2264 from daviddavis/temp_1368467168

Encapsulating code that would cause problems for headpin