Fix divide-by-zero bug, and wrap data download in begin/exception in case it fails