fixed isFirstTime() logic and added safety to avoid atoi running into null