sort blocks by position