tests and resultant bugfixes