removed debug
added offline check