Fix work with time periods