some bugfixes and api improvements