add check for lottery and update view
merge master to peyue branch