Improve platform detection