Good call, that's exactly what's wrong! The black "sticks" are dead worms. Pupae are golden-tan and chubby.
If the sides of your container are smooth and vertical, you don't really need a lid. Mealworms are the larvae of darkling beetles, which can't fly (and don't bite) and neither the larvae nor the adults can climb smooth sides, so they won't escape. If you're more comfortable with a lid, then you'll need LOTS of ventilation. For my first box, I used the tip of a hot glue gun to melt holes all over the top and up high on the sides - worked like a charm!
For the mini aquarium, I fitted the top with a piece of window screen mesh, not to keep the critters in, but to keep my cats out! Apparently, darkling beetles are great fun to pull out and chase - a lesson I learned the hard way when my worms were in an open bowl!
Whatever you use, make sure it's clean and dry before starting over. You want to make sure there's no mold or mildew left. Then you can simply sort out the live mealworms and put them in their new home with fresh food. They don't need water. They'll get all they need from a slice of potato or apple.
Good Luck!
EDIT To Add: And there's my "What Made You Happy Today?" response. I got to help someone get started on a project that will save a lot of money and make for some very happy chickens. It feels good to help!