Fixing porting errors