Fixing fencing issues in headpin

Fixes #1639