fix bug on library mode