Remove the array_unique that is causing PHP debug notices.  As per the PHP manual, array_unique should not be used  on multi-dimensional arrays.