compiler: fixed typedef handling bugs