fix crash when test is NULL