Fix condition checking in statistics saving.