fixing some platform independence bugs