changes in api and some bugfixes