support for nil
fixed save logic