Adding a check and fixing TARGETURI