fixes to calculating many subject distances

Signed-off-by: Zarrar Shehzad <czarrar@gmail.com>