fixed for all-to-one and one-to-all cases
(bug introduced by indentation mismatch)