bugfixes to make it compatible with Matevz's collector.
production Version