Fixing unique_base join

When using an join in unique_base, all the where statements became on statements because of faulty join code (using class instead of fieldname)