You are close enough. There was an old system for milk prior to the current expanded farm and not all the necessary parts(such as daysunmilked) have moved over to the new system. There is a lot of messing code and math, and some of that is likely related to milkstorage sometimes having unexpected values. I haven't taken the time to read through the code and clean up milking yet.