Fixes to bugs in utility functions and additional testing files