added portability code