Fixes to analysis script