Fixed stats issue on Linux + some minor changes