Reorder assertions to avoid Nullref exception.