fix some bugs in earlystopping.