I would obviously make sure that the bases, rings, and scope are firmly mounted....
But with that said, I recently experienced this same thing with 777 pellets. I would get good groups, and then get a few flyers, and then terrible groups, and then a decent group...... I was extremely frustrated too.
I went to loose powder -- very, very consistent groups and cheaper. I will never use pellets again.
That's my experience. Hope it helps.