bux fixes and more unit tests for functions