distinct fix, distinct does not work on rds db