Fixed some library bugs.