Portability fixes and added stability