Fix some bugs in offline mode