Add some not null checks to API methods