Fixed some bugs with updating and caching