fix time detection