Fixed #22434 and wrote test in the custom manager tests