add leap detection