Various fixes, trying to get APIs to successfully work with background threads