Prevent division by zero warnings

Prevent division by zero warnings causing the script to take up execution time on calculations