Fix check to protect against division by 0: check the correct variable