While rewriting the code I forgot to separate the period as index and
the period as value. Now it is fixed.