Repair paydays and add self checks (fixes #204).

Adds self checks as suggested at #204.
Fixes to the `paydays` table are included in branch.sql.

@whit537 Could you review please?