If your icing became a runny mess, your cookies were probably still a little warm. If your cookies are even a little warm, the icing won't stick to them.