Fix possible synchronization issue that might cause getStore() to return null. Might be related to bug #5425. Also check for it so any such error is reported earlier.