I don't think it's your code, I think it might be something inherent to terrains. For instance, according to the manual "Terrain can't be animated, rotated, moved, or scaled." I am thinking that making it passable or not might fall into one of these categories.

Have you tried making a level with just a terrain set to passable, just to see whether the engine can actually handle this?