fix duplicate issue with attributes 

Not 100% sure but has worked for half a year without problems.