now works perfect in offline mode