Fix error when uri is nil.