rearrange and check gradient things