fix bug
optimize performance