Fixed Invalidate function