updated persist code to match the macro code