Some slightly changes for portability