Fix semantic issues