Fix edge cases for peer ID parsing

Fixes #27