Fix memory leak on setStore