Fixing date overflow bugs when adding keys