bugfixes, reorganization