make it possible use custom state dict