Trivial fixes and API tests