Avoid division by 0 bug