Fix bug with period changing