Fixed a bug that caused the library to use 100% cpu