Payout fixes

Fixes #743 once merged. Hopefully for good this time.

Also addresses a PPLNS payout issue that I stumbled across while checking the code.