First, ensure your macarons are completely cooled before filling them with ganache or any other type of filling.  Second, make sure the ganache or filling is not too wet. If it is, set the macarons in the fridge for a while so the filling will firm up.  Finally, keep your macarons fresh by storing them in the fridge or freezer in a sealed jar.