updated to fix some detection issues