Lotto: Fix testcase and bugs