Fixed #1090
Handling URI with no hostname
Fixed unregistering event at cancel