Various test and bug fixes; addresses some recent changes in the API