add online/offline support