Add cache function

fix some bug
add img cache and fix some bug