Peel potatoes and cut into quarters. Cook in boiling water until soft enough to mash.
Drain well, reserving 2 cups of potato water for dough.
Return potatoes to the pot and add grated cheese and sautéed onion. Mash until smooth. Let filling cool while making the dough.
In a large bowl, sift flour and combine with salt.
Mix together water, oil and egg, and pour half of mixture into flour. Mix and slowly add the remaining liquid. Knead by hand until flour and liquid are well combined, into an elastic ball. You may need to add a small amount of either flour or water, depending on the consistency of the dough.
When well blended and smooth, wrap in plastic wrap or a clean plastic bag and let dough rest for at least 30 minutes.
Cut dough in half or in thirds, keeping unused dough well wrapped in plastic until needed. Flour the table or counter lightly and roll dough to about 1/8 inch thickness (thin is best, but not too thin, as you don't want the dough to break as you fill your perogy).
Cut the dough in rounds using a biscuit cutter or a small drinking glass (upside down).
Scoop about 1 Tbsp of potato filling for each perogy and roll into a ball in the palms of your hands.
Fill each round of dough with a ball of potato filling and seal the edges of the dough together with your fingers. Make sure when pinching the edges to ensure there are no gaps or that the 2 sides of the dough do not pull away from each other. Wet you fingers just a little if needed to help dough stick together.
Freeze on a baking tray and then transfer to a freezer bag if making in advance.
To cook, bring a pot of water to a boil and cook in small batches (10-15 perogies at a time), stirring gently to prevent dumplings from sticking together. Perogies are finished cooking when they float to the top.
Use a slotted spoon to remove them from water and drain before transferring to a serving bowl. Toss with butter and serve hot with sour cream. Add fried onions and.or bacon bits to take your perogies to the next level!