Fixed the bug when dividing by zero