rearrange and fix test