Fix issue in last commit

Check sub-partitions after split
Modify find_mean fuction