fixed best_in_place error
added image caching