Fixed NPE that can occur when recreating from saved state