This often happens when the powdered sugar has not been sifted, especially if it is getting old or has been previously opened and not fresh out of the bag. You can also get lumps from using butter that is too cold and hasn't mixed properly.