Group and color

Consider some minimal sample data that looks like my data:

library(reshape2)
library(ggplot2)
x <- seq(1, 5, length = 100)
y <- replicate(10, sin(2 * pi * x) + rnorm(100, 0, 0.3), "list")
z <- replicate(10, sin(2 * pi * x) + rnorm(100, 5, 0.3), "list")
y <- melt(y)
z <- melt(z)
df <- data.frame(x = y$Var1, rep = y$Var2, y = y$value, z = z$value)
dat <- melt(df, id = c("x", "rep"))
ggplot(dat) + geom_line(aes(x, value, group = rep, color = variable), 
    alpha = 0.3) + facet_wrap(~variable)

plot of chunk unnamed-chunk-2

I'd like for these to be on the same plot. I thought having both group=rep and color=variable would give me that effect. Instead, when I try to drop the facet wrap, I get something that does not group correctly:

ggplot(dat) + geom_line(aes(x, value, group = rep, color = variable), 
    alpha = 0.2)

plot of chunk unnamed-chunk-3