check log before, to make performance better