fix bug in programGenerator