fix isValidInProgram for extract function