Fix bug in analysis script