bugfix to avoid division by zero