Fixed some cross platform issues