Fix cross platform issues