minor bug fix for rearranging