FIX #2231: add missing stack check when applying a PAP