Add explicit type check on optional detector