fixing a few cross platform bugs