Fixing id behaviour when already found in query.