Fix NPE when unloading systems if we couldn't connect to SQL