Divide by zero error on bad image fixed