Partial implementation of fix for :clean-targets sanity checking (issue #1458)