Add getApiMode() function, tidy assertions