Fixed a bug causing stack overflow with recursive calling when loading
saved data. Previous implementation was bad but new is not perfect
either, might cause concurrency problem later.