Fixed bug in custom period