Handle client-provided username correctly

Fixes #1