Small fix for removing agent before checking

Small fix for removing agent before checking