Minor fixes to test factory