_unique() performance update

also fix bug when $desired===null passed as argument
Merge pull request #466 from DarkSide666/patch-7

_unique() performance update