fix lastday detection