Backported fixes from aquila-api-hub