minor bugfixes and profiling