Tried to handle the dvision by zero exception

Tried to handle the dvision by zero exception.