BUG api and test fixes