fixed flattening of if/switch