If your muffins flatten out then they were under baked. Check the temperature of your oven and make sure that it is cooking at the right temperature. You can do this by using a oven thermometer. Also make sure to check the muffins for doneness using by inserting a toothpick in the center of a muffin. If it comes out clean then the muffins are done.