the first part of the check is quite strange indeed, static analysis tools will point their finger at it.