fix bugs in analyze script