Fixed issues of library being undefined