Fixed bug where invalid uri format would cause an error