added offline detection ONLOAD