fix a problem where storage accessed before written. (the 'ladies.jpg' bug)