fixing problem with null headers

Closes #595.