api cleanup, bugfixes