Fixes some inconsistentes with the api and adds some debugging output
Adds a smoke test