Fix platform detection on Python 3