code cleanup, fixed cache issue