Remote my crappy fix for duplicate textures, just fix up the original method using strstr incorrectly.
strstr returns 0 (null) when there is no occurrence of string in a string. Our if statement was checking if it was 0 when we were checked if it exists, simply changing this to a != instead of == solves this problem