Portability fixes

Portability fixes added