To avoid this you need to either line your pan with parchment paper or grease it well with butter or oil. To line a pan with parchment, place the pan on top of the parchment paper, draw an outline and cut it with the scissors. Now fit this inside the pan and bake your cake.