Calculate period correctly.