Fixed hostname for real, turns out uri.hostname is almost always set to NULL.