Bug fixes with payperiod handling