no duplicate ids, some bugfixes