Fix bug that some metric values would be 'null' at some time points.