fix possible nil error for calories summation