fix platform selection and exception catch