Fixing the reference date computing that was not working correctly