Fix platform detection (previous implementation was broken)