Fixes in API handling