fix bug in portable lib