think i finally fixed ag buy bug