Added checks to prevent href exploiting