ZERO DIVISOR FIX ATTEMPTS

attempt at fixing zero divisor errors
also fix  var error in server functions