fixed some id grabbing logic