Fixed detection bugs on Mac