minor bugfixes
threading corrected