improved online/offline handling