fixed bulletref bug, added unit tests