Fixed up test so it runs standalone but there seems to be a leak somewhere