code cleanup from cherry pick