rework the code for Solaris