Fix build in a portable way