Fixes porting mistakes