Fixes a bug in PA_delta_P (port to 0.5).
Cherry-picking better handling of periodic fircing from a feature branch.