Evolution of sausage and helical modes in magnetized thin-foil cylindrical liners driven by a Z-pinch