Correctly determine runStart and runEnd from log file, close #890
Correctly determine the bucket for a timestamp equals to max, close #891