Fixed bugs with windows compatibility