portable mode check implementation. non-compilable at this moment