Fix sort based on date