fixed unique function