lib: add guards and remove nested ping timer