better error messages when headers are missing

resolves #17 and #18