Added some tests for persisted and fixed a similar piece here.