fix the bug when only one picture is opened

using promise to wait until all data is ready
- TODO : improvement rendering with render function