fix bug in cached for