a few bugfixes and use id for lookup instead of names