update to work with new API, bugfixes