Fix getheaders bug

Closes #7
Fix encoding bug

Should have been more thorough in my integration tests