check for encoded urls plus bug fix