fix issure#3
code refactor