While testing something, I saw that the where clause was missing in the first subquery (necessary for performance)