MDL-29938 Fix typo bypassing some code + remove misplaced code in deprecated function + some code cleaning