Type nesting depth in malloc cast is wrong(reversed?).
changed typNest.