fixed extra bonus bug
Fixed #1630, added test case for cookie persistence.