Fix API and tests