Fix query issue with new id's