add helper function to detect user_agent