Fixed some tests and API class