fix bugs in loading pictures. bug still have bugs(criticlly it's not a
bug. it's one function).