Added tests for #21866,#21508
added tests for #21866, #21508