fix bug when time_types is an empty array.

I do not know why it is this way, but this makes
the timelines.js code more robust and fixes the bug.