Fixed inversions bug