Cache fix and remove debug code