change lstat to stat - work on windows