test public mode, fix some logic, close #382