Fixed duplicate link bug by trimming strings in array