bugfixes; sorting