fixed online/offline detection (#1)