Database: fixed ->wherePrimary() on backjoined selection