Fix some bugs in library
Fixed compass library