Fixed more porting bugs.