Fix some payment logic bugs.