fix parent levels detection bug