handling nil values in done-ness and avoiding division by zero