fix summarize 500 and also add some guards.

if len(timestamps) = len(series) - 1, then the code breaks and returns 500 to client.