sameday function fix