Fix bugs and update library.