Various fixes to the API