merge from tom, permissions and bugfixes