Temp fix to guard null item during shutdown
minor cleanup of layout saving