Fix malformed uri

Fixes #978