fixed typo and made tests more robust