Remove unsafe call to `head`

Hi @gatlin, 

here's a pull request without the call to head. 

There is another tweak, will submit a pull request for that separately...

Thanks!

Ranjit.