bug fixes for persisting data