API test + misc fixes

#171 
Minor changes to the unit tests in API. There is nothing much to test since the API are just facades... (CMIIW)
There are some misc changes here as well
Should merge #209 first before merging this (this branch is based on it)