Fix stat call on Linux

stat on Linux has completely different flags than stat on Mac.