rename the "urlFinal" to "finalUrl" and fix a bug in this function