removing nil values to prevent math error