Another buf fix (thread issue)

Bug fix, there is still alot more to add and refactoring to be done!